using Microsoft.AspNetCore.SignalR;
using WMS.RealTime.API.Hubs;
using WMS.RealTime.IServers.Interfaces;

namespace WMS.RealTime.API.Services
{
    /// <summary>
    /// 大屏Hub代理服务
    /// </summary>
    public class DashboardHubProxy : IDashboardHub
    {
        private readonly IHubContext<DashboardHub> _hubContext;

        public DashboardHubProxy(IHubContext<DashboardHub> hubContext)
        {
            _hubContext = hubContext;
        }

        /// <summary>
        /// 发送今日概况数据
        /// </summary>
        public async Task SendTodayOverviewAsync(object data)
        {
            await _hubContext.Clients.Group("dashboard").SendAsync("ReceiveTodayOverview", data);
        }

        /// <summary>
        /// 发送昨日概况数据
        /// </summary>
        public async Task SendYesterdayOverviewAsync(object data)
        {
            await _hubContext.Clients.Group("dashboard").SendAsync("ReceiveYesterdayOverview", data);
        }

        /// <summary>
        /// 发送库存占比数据
        /// </summary>
        public async Task SendInventoryProportionAsync(object data)
        {
            await _hubContext.Clients.Group("dashboard").SendAsync("ReceiveInventoryProportion", data);
        }

        /// <summary>
        /// 发送入库统计数据
        /// </summary>
        public async Task SendInboundStatisticsAsync(object data)
        {
            await _hubContext.Clients.Group("dashboard").SendAsync("ReceiveInboundStatistics", data);
        }

        /// <summary>
        /// 发送待办事项数据
        /// </summary>
        public async Task SendTodoItemsAsync(object data)
        {
            await _hubContext.Clients.Group("dashboard").SendAsync("ReceiveTodoItems", data);
        }

        /// <summary>
        /// 发送告警数据
        /// </summary>
        public async Task SendAlertDataAsync(object data)
        {
            await _hubContext.Clients.Group("dashboard").SendAsync("ReceiveAlertData", data);
        }

        /// <summary>
        /// 发送排名数据
        /// </summary>
        public async Task SendRankingDataAsync(object data)
        {
            await _hubContext.Clients.Group("dashboard").SendAsync("ReceiveRankingData", data);
        }

        /// <summary>
        /// 发送系统消息
        /// </summary>
        public async Task SendSystemMessageAsync(string message)
        {
            await _hubContext.Clients.Group("dashboard").SendAsync("ReceiveSystemMessage", message);
        }
    }
} 